package de.geraldschenke.tictactoe;

import android.os.Handler;
import android.os.Message;
import de.geraldschenke.tictactoe.common.GameEvent;
import de.geraldschenke.tictactoe.common.RemotePlayer;

public class HumanPlayer implements RemotePlayer {
	private final Handler handler;
	private int playerId = -1;

	public HumanPlayer(final Handler handler) {
		this.handler = handler;
	}

	@Override
	public void handleGameEvent(final GameEvent gameEvent) {
		Message m = Message.obtain(handler, gameEvent.type.ordinal(), gameEvent);
		handler.sendMessage(m);
	}

	@Override
	public void setPlayerId(int id) {
		playerId = id;
	}
	
	public int getPlayerId(){
		return playerId;
	}
}
